package com.lwj.diao.handlers;

import com.lwj.diao.Htmls;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import java.io.IOException;

public class IndexHandler implements HttpHandler {
    final byte[] mIndexBytes = Htmls.HTML_INDEX.toString().getBytes(Htmls.UTF8_CS);

    @Override
    public void handle(HttpExchange exchange) throws IOException {
        exchange.sendResponseHeaders(200, this.mIndexBytes.length);
        exchange.getResponseBody().write(this.mIndexBytes);
        exchange.getResponseBody().close();
    }
}
